
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>TypeScript 1.4 · TypeScript Handbook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Patrick Zhong">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="TypeScript 1.5.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../handbook/tutorials/">
            
                <a href="../handbook/tutorials/">
            
                    
                    快速上手
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../handbook/tutorials/TypeScript in 5 minutes.html">
            
                <a href="../handbook/tutorials/TypeScript in 5 minutes.html">
            
                    
                    5分钟了解TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../handbook/tutorials/ASP.NET Core.html">
            
                <a href="../handbook/tutorials/ASP.NET Core.html">
            
                    
                    ASP.NET Core
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../handbook/tutorials/ASP.NET 4.html">
            
                <a href="../handbook/tutorials/ASP.NET 4.html">
            
                    
                    ASP.NET 4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../handbook/tutorials/Gulp.html">
            
                <a href="../handbook/tutorials/Gulp.html">
            
                    
                    Gulp
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../handbook/tutorials/Knockout.html">
            
                <a href="../handbook/tutorials/Knockout.html">
            
                    
                    Knockout.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../handbook/tutorials/React & Webpack.html">
            
                <a href="../handbook/tutorials/React & Webpack.html">
            
                    
                    React与webpack
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../handbook/tutorials/React.html">
            
                <a href="../handbook/tutorials/React.html">
            
                    
                    React
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../handbook/tutorials/Angular 2.html">
            
                <a href="../handbook/tutorials/Angular 2.html">
            
                    
                    Angular 2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../handbook/tutorials/Migrating from JavaScript.html">
            
                <a href="../handbook/tutorials/Migrating from JavaScript.html">
            
                    
                    从JavaScript迁移到TypeScript
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../handbook/">
            
                <a href="../handbook/">
            
                    
                    手册
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../handbook/Basic Types.html">
            
                <a href="../handbook/Basic Types.html">
            
                    
                    基础类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../handbook/Variable Declarations.html">
            
                <a href="../handbook/Variable Declarations.html">
            
                    
                    变量声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../handbook/Interfaces.html">
            
                <a href="../handbook/Interfaces.html">
            
                    
                    接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../handbook/Classes.html">
            
                <a href="../handbook/Classes.html">
            
                    
                    类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../handbook/Functions.html">
            
                <a href="../handbook/Functions.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../handbook/Generics.html">
            
                <a href="../handbook/Generics.html">
            
                    
                    泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../handbook/Enums.html">
            
                <a href="../handbook/Enums.html">
            
                    
                    枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../handbook/Type Inference.html">
            
                <a href="../handbook/Type Inference.html">
            
                    
                    类型推论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../handbook/Type Compatibility.html">
            
                <a href="../handbook/Type Compatibility.html">
            
                    
                    类型兼容性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../handbook/Advanced Types.html">
            
                <a href="../handbook/Advanced Types.html">
            
                    
                    高级类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../handbook/Utilit Types.md">
            
                <span>
            
                    
                    实用工具类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../handbook/Symbols.html">
            
                <a href="../handbook/Symbols.html">
            
                    
                    Symbols
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="../handbook/Iterators and Generators.html">
            
                <a href="../handbook/Iterators and Generators.html">
            
                    
                    Iterators 和 Generators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.14" data-path="../handbook/Modules.html">
            
                <a href="../handbook/Modules.html">
            
                    
                    模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.15" data-path="../handbook/Namespaces.html">
            
                <a href="../handbook/Namespaces.html">
            
                    
                    命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.16" data-path="../handbook/Namespaces and Modules.html">
            
                <a href="../handbook/Namespaces and Modules.html">
            
                    
                    命名空间和模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.17" data-path="../handbook/Module Resolution.html">
            
                <a href="../handbook/Module Resolution.html">
            
                    
                    模块解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.18" data-path="../handbook/Declaration Merging.html">
            
                <a href="../handbook/Declaration Merging.html">
            
                    
                    声明合并
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.19" data-path="../handbook/Writing Definition Files.html">
            
                <a href="../handbook/Writing Definition Files.html">
            
                    
                    书写.d.ts文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.20" data-path="../handbook/JSX.html">
            
                <a href="../handbook/JSX.html">
            
                    
                    JSX
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.21" data-path="../handbook/Decorators.html">
            
                <a href="../handbook/Decorators.html">
            
                    
                    Decorators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.22" data-path="../handbook/Mixins.html">
            
                <a href="../handbook/Mixins.html">
            
                    
                    混入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.23" data-path="../handbook/Triple-Slash Directives.html">
            
                <a href="../handbook/Triple-Slash Directives.html">
            
                    
                    三斜线指令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.24" data-path="../handbook/Type Checking JavaScript Files.html">
            
                <a href="../handbook/Type Checking JavaScript Files.html">
            
                    
                    JavaScript文件里的类型检查
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../handbook/declaration files/Introduction.html">
            
                <a href="../handbook/declaration files/Introduction.html">
            
                    
                    如何书写声明文件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../handbook/declaration files/Library Structures.html">
            
                <a href="../handbook/declaration files/Library Structures.html">
            
                    
                    结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../handbook/declaration files/Do's and Don'ts.html">
            
                <a href="../handbook/declaration files/Do's and Don'ts.html">
            
                    
                    规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../handbook/declaration files/By Example.html">
            
                <a href="../handbook/declaration files/By Example.html">
            
                    
                    举例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../handbook/declaration files/Deep Dive.html">
            
                <a href="../handbook/declaration files/Deep Dive.html">
            
                    
                    深入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../handbook/declaration files/Publishing.html">
            
                <a href="../handbook/declaration files/Publishing.html">
            
                    
                    发布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../handbook/declaration files/Consumption.html">
            
                <a href="../handbook/declaration files/Consumption.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../handbook/tsconfig.json.html">
            
                <a href="../handbook/tsconfig.json.html">
            
                    
                    工程配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../handbook/tsconfig.json.html">
            
                <a href="../handbook/tsconfig.json.html">
            
                    
                    tsconfig.json
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../handbook/Project References.html">
            
                <a href="../handbook/Project References.html">
            
                    
                    工程引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../handbook/Typings for NPM Packages.html">
            
                <a href="../handbook/Typings for NPM Packages.html">
            
                    
                    NPM包的类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../handbook/Compiler Options.html">
            
                <a href="../handbook/Compiler Options.html">
            
                    
                    编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../handbook/Configuring Watch.html">
            
                <a href="../handbook/Configuring Watch.html">
            
                    
                    配置 Watch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../handbook/Compiler Options in MSBuild.html">
            
                <a href="../handbook/Compiler Options in MSBuild.html">
            
                    
                    在MSBuild里使用编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="../handbook/Integrating with Build Tools.html">
            
                <a href="../handbook/Integrating with Build Tools.html">
            
                    
                    与其它构建工具整合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="../handbook/Nightly Builds.html">
            
                <a href="../handbook/Nightly Builds.html">
            
                    
                    使用TypeScript的每日构建版本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../wiki/">
            
                <a href="../wiki/">
            
                    
                    Wiki
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../wiki/this-in-TypeScript.html">
            
                <a href="../wiki/this-in-TypeScript.html">
            
                    
                    TypeScript里的this
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../wiki/coding_guidelines.html">
            
                <a href="../wiki/coding_guidelines.html">
            
                    
                    编码规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../wiki/Common Errors.html">
            
                <a href="../wiki/Common Errors.html">
            
                    
                    常见编译错误
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../wiki/TypeScript-Editor-Support.html">
            
                <a href="../wiki/TypeScript-Editor-Support.html">
            
                    
                    支持TypeScript的编辑器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                <a href="../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                    
                    结合ASP.NET v5使用TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../wiki/Architectural-Overview.html">
            
                <a href="../wiki/Architectural-Overview.html">
            
                    
                    架构概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../wiki/Roadmap.html">
            
                <a href="../wiki/Roadmap.html">
            
                    
                    发展路线图
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../release-notes/">
            
                <a href="../release-notes/">
            
                    
                    新增功能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../release-notes/TypeScript 3.1.html">
            
                <a href="../release-notes/TypeScript 3.1.html">
            
                    
                    TypeScript 3.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../release-notes/TypeScript 3.0.html">
            
                <a href="../release-notes/TypeScript 3.0.html">
            
                    
                    TypeScript 3.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../release-notes/TypeScript 2.9.html">
            
                <a href="../release-notes/TypeScript 2.9.html">
            
                    
                    TypeScript 2.9
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../release-notes/TypeScript 2.8.html">
            
                <a href="../release-notes/TypeScript 2.8.html">
            
                    
                    TypeScript 2.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../release-notes/TypeScript 2.7.html">
            
                <a href="../release-notes/TypeScript 2.7.html">
            
                    
                    TypeScript 2.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../release-notes/TypeScript 2.6.html">
            
                <a href="../release-notes/TypeScript 2.6.html">
            
                    
                    TypeScript 2.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../release-notes/TypeScript 2.5.html">
            
                <a href="../release-notes/TypeScript 2.5.html">
            
                    
                    TypeScript 2.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../release-notes/TypeScript 2.4.html">
            
                <a href="../release-notes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../release-notes/TypeScript 2.3.html">
            
                <a href="../release-notes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="../release-notes/TypeScript 2.2.html">
            
                <a href="../release-notes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.11" data-path="../release-notes/TypeScript 2.1.html">
            
                <a href="../release-notes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.12" data-path="../release-notes/TypeScript 2.0.html">
            
                <a href="../release-notes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.13" data-path="../release-notes/TypeScript 1.8.html">
            
                <a href="../release-notes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.14" data-path="../release-notes/TypeScript 1.7.html">
            
                <a href="../release-notes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.15" data-path="../release-notes/TypeScript 1.6.html">
            
                <a href="../release-notes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.16" data-path="../release-notes/TypeScript 1.5.html">
            
                <a href="../release-notes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.17" data-path="../release-notes/TypeScript 1.4.html">
            
                <a href="../release-notes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.18" data-path="../release-notes/TypeScript 1.3.html">
            
                <a href="../release-notes/TypeScript 1.3.html">
            
                    
                    TypeScript 1.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.19" data-path="../release-notes/TypeScript 1.1.html">
            
                <a href="../release-notes/TypeScript 1.1.html">
            
                    
                    TypeScript 1.1
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="breaking-changes.html">
            
                <a href="breaking-changes.html">
            
                    
                    Breaking Changes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="TypeScript 2.4.html">
            
                <a href="TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="TypeScript 2.3.html">
            
                <a href="TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="TypeScript 2.2.html">
            
                <a href="TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="TypeScript 2.1.html">
            
                <a href="TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="TypeScript 2.0.html">
            
                <a href="TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="TypeScript 1.8.html">
            
                <a href="TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="TypeScript 1.7.html">
            
                <a href="TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="TypeScript 1.6.html">
            
                <a href="TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="TypeScript 1.5.html">
            
                <a href="TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.8.10" data-path="TypeScript 1.4.html">
            
                <a href="TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >TypeScript 1.4</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="typescript-14">TypeScript 1.4</h1>
<p>&#x5B8C;&#x6574;&#x7684;&#x7834;&#x574F;&#x6027;&#x6539;&#x52A8;&#x5217;&#x8868;&#x8BF7;&#x5230;&#x8FD9;&#x91CC;&#x67E5;&#x770B;:<a href="https://github.com/Microsoft/TypeScript/issues?q=is%3Aissue+milestone%3A%22TypeScript+1.4%22+label%3A%22breaking+change%22" target="_blank">breaking change issues</a>&#x3002;</p>
<p>&#x9605;&#x8BFB;<a href="https://github.com/Microsoft/TypeScript/issues/868" target="_blank">issue #868</a>&#x4EE5;&#x4E86;&#x89E3;&#x66F4;&#x591A;&#x5173;&#x4E8E;&#x8054;&#x5408;&#x7C7B;&#x578B;&#x7684;&#x7834;&#x574F;&#x6027;&#x6539;&#x52A8;&#x3002;</p>
<h4 id="&#x591A;&#x4E2A;&#x6700;&#x4F73;&#x901A;&#x7528;&#x7C7B;&#x578B;&#x5019;&#x9009;">&#x591A;&#x4E2A;&#x6700;&#x4F73;&#x901A;&#x7528;&#x7C7B;&#x578B;&#x5019;&#x9009;</h4>
<p>&#x5F53;&#x6709;&#x591A;&#x4E2A;&#x6700;&#x4F73;&#x901A;&#x7528;&#x7C7B;&#x578B;&#x53EF;&#x7528;&#x65F6;&#xFF0C;&#x73B0;&#x5728;&#x7F16;&#x8BD1;&#x5668;&#x4F1A;&#x505A;&#x51FA;&#x9009;&#x62E9;&#xFF08;&#x4F9D;&#x636E;&#x7F16;&#x8BD1;&#x5668;&#x7684;&#x5177;&#x4F53;&#x5B9E;&#x73B0;&#xFF09;&#x800C;&#x4E0D;&#x662F;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x7B2C;&#x4E00;&#x4E2A;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">var</span> a: { x: <span class="hljs-built_in">number</span>; y?: <span class="hljs-built_in">number</span> };
<span class="hljs-keyword">var</span> b: { x: <span class="hljs-built_in">number</span>; z?: <span class="hljs-built_in">number</span> };

<span class="hljs-comment">// &#x4E4B;&#x524D; { x: number; z?: number; }[]</span>
<span class="hljs-comment">// &#x73B0;&#x5728; { x: number; y?: number; }[]</span>
<span class="hljs-keyword">var</span> bs = [b, a];
</code></pre>
<p>&#x8FD9;&#x4F1A;&#x5728;&#x591A;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#x53D1;&#x751F;&#x3002;&#x5177;&#x6709;&#x4E00;&#x7EC4;&#x5171;&#x4EAB;&#x7684;&#x5FC5;&#x9700;&#x5C5E;&#x6027;&#x548C;&#x4E00;&#x7EC4;&#x5176;&#x5B83;&#x4E92;&#x65A5;&#x7684;&#xFF08;&#x53EF;&#x9009;&#x6216;&#x5176;&#x5B83;&#xFF09;&#x5C5E;&#x6027;&#xFF0C;&#x7A7A;&#x7C7B;&#x578B;&#xFF0C;&#x517C;&#x5BB9;&#x7684;&#x7B7E;&#x540D;&#x7C7B;&#x578B;&#xFF08;&#x5305;&#x62EC;&#x6CDB;&#x578B;&#x548C;&#x975E;&#x6CDB;&#x578B;&#x7B7E;&#x540D;&#xFF0C;&#x5F53;&#x7C7B;&#x578B;&#x53C2;&#x6570;&#x4E0A;&#x5E94;&#x7528;&#x4E86;<code>any</code>&#x65F6;&#xFF09;&#x3002;</p>
<p><strong>&#x63A8;&#x8350;</strong>
&#x4F7F;&#x7528;&#x7C7B;&#x578B;&#x6CE8;&#x89E3;&#x6307;&#x5B9A;&#x4F60;&#x8981;&#x4F7F;&#x7528;&#x7684;&#x7C7B;&#x578B;&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">var</span> bs: { x: <span class="hljs-built_in">number</span>; y?: <span class="hljs-built_in">number</span>; z?: <span class="hljs-built_in">number</span> }[] = [b, a];
</code></pre>
<h4 id="&#x6CDB;&#x578B;&#x63A5;&#x53E3;">&#x6CDB;&#x578B;&#x63A5;&#x53E3;</h4>
<p>&#x5F53;&#x5728;&#x591A;&#x4E2A;T&#x7C7B;&#x578B;&#x7684;&#x53C2;&#x6570;&#x4E0A;&#x4F7F;&#x7528;&#x4E86;&#x4E0D;&#x540C;&#x7684;&#x7C7B;&#x578B;&#x65F6;&#x4F1A;&#x5F97;&#x5230;&#x4E00;&#x4E2A;&#x9519;&#x8BEF;&#xFF0C;&#x5C31;&#x7B97;&#x662F;&#x6DFB;&#x52A0;&#x7EA6;&#x675F;&#x4E5F;&#x4E0D;&#x884C;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">declare</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">foo</span>&lt;<span class="hljs-title">T</span>&gt;(<span class="hljs-params">x: T, y:T</span>): <span class="hljs-title">T</span></span>;
<span class="hljs-keyword">var</span> r = foo(<span class="hljs-number">1</span>, <span class="hljs-string">&quot;&quot;</span>); <span class="hljs-comment">// r used to be {}, now this is an error</span>
</code></pre>
<p>&#x6DFB;&#x52A0;&#x7EA6;&#x675F;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">interface</span> Animal { x }
<span class="hljs-keyword">interface</span> Giraffe <span class="hljs-keyword">extends</span> Animal { y }
<span class="hljs-keyword">interface</span> Elephant <span class="hljs-keyword">extends</span> Animal { z }
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">f</span>&lt;<span class="hljs-title">T</span> <span class="hljs-title">extends</span> <span class="hljs-title">Animal</span>&gt;(<span class="hljs-params">x: T, y: T</span>): <span class="hljs-title">T</span> </span>{ <span class="hljs-keyword">return</span> <span class="hljs-literal">undefined</span>; }
<span class="hljs-keyword">var</span> g: Giraffe;
<span class="hljs-keyword">var</span> e: Elephant;
f(g, e);
</code></pre>
<p>&#x5728;&#x8FD9;&#x91CC;&#x67E5;&#x770B;<a href="https://github.com/Microsoft/TypeScript/pull/824#discussion_r18665727" target="_blank">&#x8BE6;&#x7EC6;&#x89E3;&#x91CA;</a>&#x3002;</p>
<p><strong>&#x63A8;&#x8350;</strong>
&#x5982;&#x679C;&#x8FD9;&#x79CD;&#x4E0D;&#x5339;&#x914D;&#x7684;&#x884C;&#x4E3A;&#x662F;&#x6545;&#x610F;&#x4E3A;&#x4E4B;&#xFF0C;&#x90A3;&#x4E48;&#x660E;&#x786E;&#x6307;&#x5B9A;&#x7C7B;&#x578B;&#x53C2;&#x6570;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">var</span> r = foo&lt;{}&gt;(<span class="hljs-number">1</span>, <span class="hljs-string">&quot;&quot;</span>); <span class="hljs-comment">// Emulates 1.0 behavior</span>
<span class="hljs-keyword">var</span> r = foo&lt;<span class="hljs-built_in">string</span>|<span class="hljs-built_in">number</span>&gt;(<span class="hljs-number">1</span>, <span class="hljs-string">&quot;&quot;</span>); <span class="hljs-comment">// Most useful</span>
<span class="hljs-keyword">var</span> r = foo&lt;<span class="hljs-built_in">any</span>&gt;(<span class="hljs-number">1</span>, <span class="hljs-string">&quot;&quot;</span>); <span class="hljs-comment">// Easiest</span>
f&lt;Animal&gt;(g, e);
</code></pre>
<p><em>&#x6216;</em>&#x91CD;&#x5199;&#x51FD;&#x6570;&#x5B9A;&#x4E49;&#x6307;&#x660E;&#x5C31;&#x7B97;&#x4E0D;&#x5339;&#x914D;&#x4E5F;&#x6CA1;&#x95EE;&#x9898;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">declare</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">foo</span>&lt;<span class="hljs-title">T</span>,<span class="hljs-title">U</span>&gt;(<span class="hljs-params">x: T, y:U</span>): <span class="hljs-title">T</span>|<span class="hljs-title">U</span></span>;
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">f</span>&lt;<span class="hljs-title">T</span> <span class="hljs-title">extends</span> <span class="hljs-title">Animal</span>, <span class="hljs-title">U</span> <span class="hljs-title">extends</span> <span class="hljs-title">Animal</span>&gt;(<span class="hljs-params">x: T, y: U</span>): <span class="hljs-title">T</span>|<span class="hljs-title">U</span> </span>{ <span class="hljs-keyword">return</span> <span class="hljs-literal">undefined</span>; }
</code></pre>
<h4 id="&#x6CDB;&#x578B;&#x5269;&#x4F59;&#x53C2;&#x6570;">&#x6CDB;&#x578B;&#x5269;&#x4F59;&#x53C2;&#x6570;</h4>
<p>&#x4E0D;&#x80FD;&#x518D;&#x4F7F;&#x7528;&#x6DF7;&#x6742;&#x7684;&#x53C2;&#x6570;&#x7C7B;&#x578B;&#xFF1A;</p>
<pre><code class="lang-ts">function makeArray&lt;T&gt;(...items: T[]): T[] { return items; }
var r = makeArray(1, &quot;&quot;); // used to return {}[], now an error
</code></pre>
<p><code>new Array(...)</code>&#x4E5F;&#x4E00;&#x6837;</p>
<p><strong>&#x63A8;&#x8350;</strong>
&#x58F0;&#x660E;&#x5411;&#x540E;&#x517C;&#x5BB9;&#x7684;&#x7B7E;&#x540D;&#xFF0C;&#x5982;&#x679C;1.0&#x7684;&#x884C;&#x4E3A;&#x662F;&#x4F60;&#x60F3;&#x8981;&#x7684;&#xFF1A;</p>
<pre><code class="lang-ts">function makeArray&lt;T&gt;(...items: T[]): T[];
function makeArray(...items: {}[]): {}[];
function makeArray&lt;T&gt;(...items: T[]): T[] { return items; }
</code></pre>
<h4 id="&#x5E26;&#x7C7B;&#x578B;&#x53C2;&#x6570;&#x63A5;&#x53E3;&#x7684;&#x91CD;&#x8F7D;&#x89E3;&#x6790;">&#x5E26;&#x7C7B;&#x578B;&#x53C2;&#x6570;&#x63A5;&#x53E3;&#x7684;&#x91CD;&#x8F7D;&#x89E3;&#x6790;</h4>
<pre><code class="lang-ts"><span class="hljs-keyword">var</span> f10: &lt;T&gt;(x: T, b: () =&gt; (a: T) =&gt; <span class="hljs-built_in">void</span>, y: T) =&gt; T;
<span class="hljs-keyword">var</span> r9 = f10(<span class="hljs-string">&apos;&apos;</span>, () =&gt; (a =&gt; a.foo), <span class="hljs-number">1</span>); <span class="hljs-comment">// r9 was any, now this is an error</span>
</code></pre>
<p><strong>&#x63A8;&#x8350;</strong>
&#x624B;&#x52A8;&#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x7C7B;&#x578B;&#x53C2;&#x6570;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">var</span> r9 = f10&lt;<span class="hljs-built_in">any</span>&gt;(<span class="hljs-string">&apos;&apos;</span>, () =&gt; (a =&gt; a.foo), <span class="hljs-number">1</span>);
</code></pre>
<h4 id="&#x7C7B;&#x58F0;&#x660E;&#x4E0E;&#x7C7B;&#x578B;&#x8868;&#x8FBE;&#x5F0F;&#x4EE5;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#x89E3;&#x6790;">&#x7C7B;&#x58F0;&#x660E;&#x4E0E;&#x7C7B;&#x578B;&#x8868;&#x8FBE;&#x5F0F;&#x4EE5;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#x89E3;&#x6790;</h4>
<p>ECMAScript 2015&#x8BED;&#x8A00;&#x89C4;&#x8303;(ECMA-262 6<sup>th</sup> Edition)&#x6307;&#x660E;<em>ClassDeclaration</em>&#x548C;<em>ClassExpression</em>&#x4F7F;&#x7528;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#x3002;
&#x56E0;&#x6B64;&#xFF0C;&#x5728;&#x89E3;&#x6790;&#x7C7B;&#x58F0;&#x660E;&#x6216;&#x7C7B;&#x8868;&#x8FBE;&#x5F0F;&#x65F6;&#x5C06;&#x4F7F;&#x7528;&#x989D;&#x5916;&#x7684;&#x9650;&#x5236;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">class</span> <span class="hljs-keyword">implements</span> {}  <span class="hljs-comment">// Invalid: implements is a reserved word in strict mode</span>
<span class="hljs-keyword">class</span> C {
    foo(<span class="hljs-built_in">arguments</span>: <span class="hljs-built_in">any</span>) {   <span class="hljs-comment">// Invalid: &quot;arguments&quot; is not allow as a function argument</span>
        <span class="hljs-keyword">var</span> <span class="hljs-built_in">eval</span> = <span class="hljs-number">10</span>;      <span class="hljs-comment">// Invalid: &quot;eval&quot; is not allowed as the left-hand-side expression</span>
        <span class="hljs-built_in">arguments</span> = [];     <span class="hljs-comment">// Invalid: arguments object is immutable</span>
    }
}
</code></pre>
<p>&#x5173;&#x4E8E;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#x9650;&#x5236;&#x7684;&#x5B8C;&#x6574;&#x5217;&#x8868;&#xFF0C;&#x8BF7;&#x9605;&#x8BFB; Annex C - The Strict Mode of ECMAScript of ECMA-262 6<sup>th</sup> Edition&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="TypeScript 1.5.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: TypeScript 1.5">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"TypeScript 1.4","level":"1.8.10","depth":2,"previous":{"title":"TypeScript 1.5","level":"1.8.9","depth":2,"path":"doc/breaking-changes/TypeScript 1.5.md","ref":"./doc/breaking-changes/TypeScript 1.5.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Patrick Zhong","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"preface.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"TypeScript Handbook","language":"zh-hans","gitbook":">3.0.0","description":"Translation of official TypeScript Handbook"},"file":{"path":"doc/breaking-changes/TypeScript 1.4.md","mtime":"2018-10-13T09:48:54.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-13T09:57:42.904Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

